package com.zbkj.service.model.dto;

import com.zbkj.dal.base.enums.FundDirectionEnums;
import com.zbkj.dal.base.enums.FundStatusEnums;
import com.zbkj.dal.base.enums.FundTradeTypeEnums;
import com.zbkj.dal.entity.fund.UserFundAccount;
import lombok.Builder;
import lombok.Data;

import java.math.BigDecimal;

@Data
@Builder
public class SaveUserBalanceRecordDTO {

    /**
     * 用户资金账户
     */
    private UserFundAccount userFundAccount;

    /**
     * 状态
     */
    private String status;

    /**
     * 业务单号
     */
    private String bizOrderNo;

    /**
     * 图片地址
     */
    private String image;

    /**
     * 金额
     */
    private BigDecimal tradeAmount;

    /**
     * 资金类型
     *
     * @see com.zbkj.dal.base.enums.FundTradeTypeEnums
     */
    private String fundType;

    /**
     * 资金方向
     *
     * @see com.zbkj.dal.base.enums.FundDirectionEnums
     */
    private Integer fundDirection;

    /**
     * 备注
     */
    private String remark;

    public static SaveUserBalanceRecordDTO buildByOrderCreate(UserFundAccount account, FundStatusEnums status, String image, String order, BigDecimal amount, FundTradeTypeEnums tradeType, FundDirectionEnums fundDirection) {
        return SaveUserBalanceRecordDTO.builder()
                .userFundAccount(account)
                .status(status.getCode())
                .bizOrderNo(order)
                .tradeAmount(amount)
                .fundType(tradeType.getCode())
                .fundDirection(fundDirection.getCode())
                .image(image)
                .build();
    }
}
